<?php

namespace app\admin\validate;

use app\common\enums\StatusEnum;
use think\Validate;

class Coupon extends Validate
{
    protected $rule = [
        'name|优惠券名称' => 'require|length:1,200',
        'money|金额' => 'require|float|min:0.0|max:10.0',
        'start_time' => 'require|<=:end_time',
        'end_time|结束时间' => 'require',
        'rule' => 'require|length:1,255',
        'sort_num|权重' => 'require|number',
        'status|状态' => 'in:' . StatusEnum::DISABLED . ',' . StatusEnum::ENABLED,
    ];

    protected $message = [
        'start_time' => '开始时间必须存在，并且小于等于结束时间'
    ];
}